import { ref,  computed } from 'vue';  
import { global } from "@/utils/index"

export function useNotLogged(){
	const userInfo = global.syncGetUerInfoByLocal()
	const isNotLogged = computed(() => userInfo?.memberId ? false : true)
	const tipToLogin = () => {
		uni.showModal({
			title: '您还未登录',
			content: '您还未登录，暂时无法使用此功能，请先登录！',
			cancelText:"先看看",
			confirmText:"去登录",
			complete() {
				console.log('都会执行')
			},
			success: function (res) {
					if (res.confirm) {
						uni.reLaunch({
							url:"/pages/login/index",
							animationType: 'pop-in',
								animationDuration: 200
						})
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
		})
	}
	return {
		isNotLogged,
		tipToLogin
	}
}